package main

import (
	"github.com/e421083458/golang_common/lib"
	"os"
	"os/signal"
	"rock/customer/initParam"
	"rock/customer/modules/cacheMap"
	"rock/customer/modules/redisModules"
	"rock/customer/modules/timeTask"
	"rock/customer/router"
	"runtime"
	"syscall"
)

// @title 创易栈1V1在线客服系统后台API
// @version 0.0.1
// @description This is a sample Server pets
// @securityDefinitions.apikey ApiKeyAuth
// @in head
// @name token
// @BasePath /
func main() {
	configPath := "./conf/pro/"
	if runtime.GOOS == "windows" {
		configPath = "./conf/dev/"
	}
	_ = lib.InitModule(configPath, []string{"base", "mysql", "redisModules"})
	defer lib.Destroy()

	//初始化数据到内存中
	initParam.PutIntoMemory()
	//
	redisModules.InitRedis()
	//初始化缓存
	cacheMap.InitCacheMap()
	//初始化计时器
	timeTask.InitTimer()

	router.HttpServerRun()

	quit := make(chan os.Signal)
	signal.Notify(quit, syscall.SIGKILL, syscall.SIGQUIT, syscall.SIGINT, syscall.SIGTERM)
	<-quit

	router.HttpServerStop()
}
